//
//  CallVC.m
//  timelyRain
//
//  Created by Jiafei Wei on 16/10/5.
//  Copyright © 2016年 Jiafei Wei. All rights reserved.
//

#import "CallVC.h"
#import "NterceptionCell.h"
#import "DbManage.h"
#import "InterceptInfo.h"
@interface CallVC ()<UITableViewDataSource,UITableViewDelegate>
{
    NSMutableArray *dataArr;
}

@property (weak, nonatomic) IBOutlet UITableView *table;
@end

@implementation CallVC

- (void)viewDidLoad {
    [super viewDidLoad];
    dataArr =[NSMutableArray array];
    NSMutableArray *callArray =[[DbManage shareDbManage] queryCallInterceptArray];
    [dataArr addObjectsFromArray:callArray];
    
    for (InterceptInfo *info in callArray) {
        info.isRead=@"YES";
    }
    [[DbManage shareDbManage] updateInterceptInfo:callArray];//设为已读了
    _table.delegate =self;
    _table.dataSource =self;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return dataArr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NterceptionCell *cell =[NterceptionCell setNterceptionCellWithTableView:tableView];
    cell.interceptInfo= [dataArr objectAtIndex:indexPath.row];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}
@end
